package com.example.seckillconsumer.feign;

import com.example.seckillconsumer.config.FeignConfig;
import com.example.seckillconsumer.hystrix.SecKillFeignHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author likaiping
 */
@Component
@FeignClient(value = "seckill-provider",fallback = SecKillFeignHystrix.class,
        configuration = FeignConfig.class)
public interface SecKillFeign {
    /**
     * 获取商品库存
     * @param gid
     * @return
     */
    @GetMapping("/getGoodsStock")
    Integer getGoodsStock(@RequestParam("gid") Integer gid);

    /**
     * 设置商品库存
     * @param gid
     * @param stock
     * @return
     */
    @GetMapping("/setGoodsStock")
    boolean setGoodsStock(@RequestParam("gid") Integer gid,@RequestParam("stock") Integer stock);

    /**
     * 修改商品库存
     * @param gid
     * @param stock
     * @return
     */
    @GetMapping("/editGoodsStock")
    boolean editGoodsStock(@RequestParam("gid") Integer gid,@RequestParam("stock") Integer stock);
}
